<template>
    <Button type="error" size="small" @click="handleLANIPDelete(data)">删除</Button>
</template>

<script>
export default {
    name: 'LANIPDeleteButton',
    props: {
        data: Object,
    },
    methods: {
        handleLANIPDelete(data) {
            this.$Modal.confirm({
                title: '删除确认',
                content: '确定要删除该IP吗？',
                onOk: () => {
                    this.$http.post("/delete_lanip", { lanip_id: data.lanip_id }).then(() => {
                        this.$Message.success('删除成功');
                        this.$emit('success');
                    });
                },
                onCancel: () => {
                    this.errorMessage('取消删除')
                }
            });
        }
    }
}
</script>